/*******************************************************************************
* Copyright (c) 2010, 2018 西安秦晔信息科技有限公司
* Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*******************************************************************************/
package com.qinyeit.serviceapp.entity;

import com.qinyeit.serviceapp.entity.enums.RechargeType;
import lombok.Builder;
import lombok.experimental.Tolerate;

import javax.persistence.*;

/**
 * ClassName: MemberCardType <br/>
 * Function: 会员卡类型 <br/>
 * date: 2018-12-03 14:58:01 <br/>
 *
 * @author DESKTOP-DHS6NG3
 * @version  1.0
 * @since JDK 1.8
 */
@Builder
@Entity
@Table(name="member_card_types")
public class MemberCardType extends MerchantGroupBaseEntity<Long> {

	private static final long serialVersionUID = 1L;

	// 名称 
    @Column(name="name", length = 300)
	private String name = null;

	// 折扣方案 
    @Column(name="discount_id")
	private Long discountId = null;

	// 是否启用会员价 
    @Column(name="has_vip_price")
	private Boolean hasVipPrice = true;

	// 是否消费返积分 
    @Column(name="has_consume_recharge")
	private Boolean hasConsumeRecharge = false;

	// 消费金额 
    @Column(name="consume_price",scale=2)
	private Double consumePrice = 0d;

	// 赠送积分 
    @Column(name="gift_point",scale=2)
	private Double giftPoint = 0d;

	// 充值规则 
    @Column(name="recharge_rule")
	private Boolean rechargeRule = false;

	// 充值规则类型 
    @Column(name="recharge_type", length = 300)
	@Enumerated(EnumType.STRING)
	private RechargeType rechargeType = RechargeType.FIXEDCASHBACK;

	//创建的时候生成 编辑的时候不变
	@Column(name="uuid", length = 300)
	private String uuid = "";

	//更新的时间戳 long
	@Column(name="update_timestamp")
	private Long updateTimestamp = null;

	/*{
	birthdayMultiple:2,
	specialDate:[{
		type:'date',
		start:'',
		end:'',
		multiple:"3"
	}],
	useType:'birthday/special/superimposed'
}*/
	//积分规则
	/*
	*
	* 会员生日倍数
	特殊日期积分倍数
	当特殊日期与生日重叠后使用那个方式
	1.会员生日
	2.按照特殊日期
	3.叠加
	* */
	@Column(name = "point_rule", columnDefinition = "mediumtext")
	private String pointRule = "";

	//是否使用规则
	@Column(name = "has_use_rule")
	private Boolean hasUseRule = false;
	//使用规则详情
	/**
	 * {
	 *	 type:everyDay/everyTime/everyTimeRatio(每天限额xx元/每次限额xx元/每次限额比例xx)
	 *	 value:xx
	 *	}
	 */
	@Column(name = "use_rule_detail", columnDefinition = "mediumtext")
	private String useRuleDetail = "";




	// 折扣方案 名称
	@Transient
	private String discountName = "";

    @Tolerate
	public MemberCardType() {
		
	}
    @Tolerate
	public MemberCardType(Long id){
    	super.setId(id);
    }
	
	/**
	 * 获取名称
	 */
	public String getName() {
		return this.name;
	}

    /**
     * 设置名称
     */
	public MemberCardType setName(String name) {
		this.name = name;
		return this;
	}

	/**
	 * 获取折扣方案
	 */
	public Long getDiscountId() {
		return this.discountId;
	}

    /**
     * 设置折扣方案
     */
	public MemberCardType setDiscountId(Long discountId) {
		this.discountId = discountId;
		return this;
	}

	/**
	 * 获取是否启用会员价
	 */
	public Boolean getHasVipPrice() {
		return this.hasVipPrice;
	}

    /**
     * 设置是否启用会员价
     */
	public MemberCardType setHasVipPrice(Boolean hasVipPrice) {
		this.hasVipPrice = hasVipPrice;
		return this;
	}

	/**
	 * 获取是否消费返积分
	 */
	public Boolean getHasConsumeRecharge() {
		return this.hasConsumeRecharge;
	}

    /**
     * 设置是否消费返积分
     */
	public MemberCardType setHasConsumeRecharge(Boolean hasConsumeRecharge) {
		this.hasConsumeRecharge = hasConsumeRecharge;
		return this;
	}

	/**
	 * 获取消费金额
	 */
	public Double getConsumePrice() {
		return this.consumePrice;
	}

    /**
     * 设置消费金额
     */
	public MemberCardType setConsumePrice(Double consumePrice) {
		this.consumePrice = consumePrice;
		return this;
	}

	/**
	 * 获取赠送积分
	 */
	public Double getGiftPoint() {
		return this.giftPoint;
	}

    /**
     * 设置赠送积分
     */
	public MemberCardType setGiftPoint(Double giftPoint) {
		this.giftPoint = giftPoint;
		return this;
	}

	/**
	 * 获取充值规则
	 */
	public Boolean getRechargeRule() {
		return this.rechargeRule;
	}

    /**
     * 设置充值规则
     */
	public MemberCardType setRechargeRule(Boolean rechargeRule) {
		this.rechargeRule = rechargeRule;
		return this;
	}

	public RechargeType getRechargeType() {
		return rechargeType;
	}

	public void setRechargeType(RechargeType rechargeType) {
		this.rechargeType = rechargeType;
	}

	public String getDiscountName() {
		return discountName;
	}

	public void setDiscountName(String discountName) {
		this.discountName = discountName;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public Long getUpdateTimestamp() {
		return updateTimestamp;
	}

	public void setUpdateTimestamp(Long updateTimestamp) {
		this.updateTimestamp = updateTimestamp;
	}

	public String getPointRule() {
		return pointRule;
	}

	public void setPointRule(String pointRule) {
		this.pointRule = pointRule;
	}

	public Boolean getHasUseRule() {
		return hasUseRule;
	}

	public void setHasUseRule(Boolean hasUseRule) {
		this.hasUseRule = hasUseRule;
	}

	public String getUseRuleDetail() {
		return useRuleDetail;
	}

	public void setUseRuleDetail(String useRuleDetail) {
		this.useRuleDetail = useRuleDetail;
	}
}
